package com.zhima.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 单个用户的得分情况
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ScoreInfo {
    /**
     * 每一道题的具体得分情况
     */
    SingleQuestionScore[] singleQuestionScores;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 用户id
     */
    private String userId;
    /**
     * 总得分
     */
    private int sumScore;
    /**
     * 用户的本场比赛的排名
     */
    private int rank;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor

    public static class SingleQuestionScore {
        /**
         * 提交了几次
         */
        private int submitNum;
        /**
         * 是否提交
         */
        private boolean isSubmit;
        /**
         * 是否是第一个AC提交的
         */
        private boolean isFirst;
        /**
         * 是否AC
         */
        private boolean isAc;
        /**
         * 分数
         */
        private int score;
    }

    public static List<SingleQuestionScore> initEmptyQuestionScores(int questionNum) {
        List<SingleQuestionScore> singleQuestionScores = new ArrayList<>();
        for (int i = 0; i < questionNum; i++) {
            singleQuestionScores.add(new SingleQuestionScore());
        }
        return singleQuestionScores;
    }
}
